"""
Copyright (C) 2010  Fabio A Martins

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
"""

from django.db import models

class Genre(models.Model):
    title = models.CharField(max_length=255)
    class Meta:
        db_table = u'genre'
    
    def __unicode__(self):
        return self.title

class Artist(models.Model):
    name = models.CharField(max_length=255)
    class Meta:
        db_table = u'artist'

    def __unicode__(self):
        return self.name

class Disc(models.Model):
    freedbid = models.CharField(max_length=8, unique=True)
    artist = models.ForeignKey(Artist, null=True)
    genre = models.ForeignKey(Genre, null=True)
    title = models.CharField(max_length=255)
    year = models.IntegerField(max_length=4, blank=True) # This field type is a guess.
    class Meta:
        db_table = u'disc'

    def __unicode__(self):
        return self.title

class Track(models.Model):
    disc = models.ForeignKey(Disc)
    track_number = models.IntegerField(max_length=3)
    title = models.CharField(max_length=255)
    class Meta:
        db_table = u'tracks'

    def __unicode__(self):
        return self.title

